using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerState 
{
    protected Player player;
    protected PlayerStateMachine playerStateMachine;
    protected string animBoolName;
    protected float xInput;
    protected float yInput;
    protected Rigidbody2D rb;
    protected float stateTime;
    protected bool triggerCalled = false;
    public PlayerState(Player player, PlayerStateMachine playerStateMachine, string animBoolName)
    {
        this.player = player;
        this.playerStateMachine = playerStateMachine;
        this.animBoolName = animBoolName;
    }
    public virtual void Enter()
    {
        rb = player.rigid;
        triggerCalled = false;
        player.animator.SetBool(animBoolName, true);
    }
    public virtual void Update()
    {
        stateTime -= Time.deltaTime;
        xInput = Input.GetAxis("Horizontal");
        yInput = Input.GetAxis("Vertical");
        player.animator.SetFloat("yVelocity", rb.velocity.y);
    }
    public virtual void Exit()
    {
        player.animator.SetBool(animBoolName, false);
    }
    public virtual void AnimatorFinishTrigger()
    {
        triggerCalled = true;
    }
}
